﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using LogLib;

namespace IPCPhotoEditor.ChildForms
{
    public partial class FormIntroduction : Form
    {
        private string _file = "";
        public FormIntroduction(string file)
        {
            _file = file;
            InitializeComponent();
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private List<string> ReadContents()
        {
            List<string> list = new List<string>();
            try
            {
                using (StreamReader sr = new StreamReader(_file, Encoding.Default))
                {
                    string line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        list.Add(line);
                    }
                }
            }
            catch (Exception e)
            {
                Log.WriteException(e.ToString());
            }
            return list;
        }

        private void FormIntroduction_Load(object sender, EventArgs e)
        {
            List<string> list = ReadContents();
            foreach (string info in list)
            {
                richTextBox1.AppendText(info);
                richTextBox1.AppendText(Environment.NewLine);
            }
        }
    }
}
